package com.pn.warehouse.service.impl;

import com.pn.warehouse.entity.Supply;
import com.pn.warehouse.mapper.SupplyMapper;
import com.pn.warehouse.service.SupplyService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@CacheConfig(cacheNames = "com.pn.warehouse.service.impl.SupplyServiceImpl")
@Service
public class SupplyServiceImpl implements SupplyService {

    @Resource
    private SupplyMapper supplyMapper;

    //查询所有供应商
    @Cacheable(key = "'all:supply'")
    @Override
    public List<Supply> findAllSupply() {
        List<Supply> allSupply = supplyMapper.findAllSupply();
        return allSupply;
    }

}
